package org.dtrd.modules.shop.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.shop.entity.bean.OrderRefundDetail;


/**
 * <p>
 * 商城订单退款表
 * </p>
 *
 * @author sun
 * @since 2022-07-25
 */
@Getter
@Setter
@TableName("dtrd_ent_shc_rd_order_refund")
public class DtrdEntShcRdOrderRefund {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 退款患者id
     */
    @TableField("refund_patient_id")
    private Integer refundPatientId;

    /**
     * 订单id
     */
    @TableField("refund_order_id")
    private String refundOrderId;

    /**
     * 订单名称
     */
    @TableField("refund_order_name")
    private String refundOrderName;

    /**
     * 订单状态
     */
    @TableField("refund_order_status")
    private Integer refundOrderStatus;

    /**
     * 退款金额，单位分
     */
    @TableField("refund_price")
    private Integer refundPrice;

    /**
     * 退款原因
     */
    @TableField("refund_reason")
    private String refundReason;

    /**
     * 退款审核时间
     */
    @TableField("refund_approve_time")
    private Date refundApproveTime;

    /**
     * 退款审核结果：0-待审核，1-同意，2-拒绝
     */
    @TableField("refund_status")
    private Integer refundStatus;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private Date createTime;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    public DtrdEntShcRdOrderRefund init() {
        createTime = new Date();
        isDel = 0;
        return this;
    }

    public DtrdEntShcRdOrderRefund parseFromDto(OrderRefundDetail dto) {
        dataId = dto.getDataId();
        refundPatientId = dto.getRefundPatientId();
        refundOrderId = dto.getRefundOrderId();
        refundOrderName = dto.getRefundOrderName();
        refundOrderStatus = dto.getRefundOrderStatus();
        refundPrice = dto.getRefundPrice();
        refundReason = dto.getRefundReason();
        refundApproveTime = dto.getRefundApproveTime();
        refundStatus = dto.getRefundStatus();
        return this;
    }


}
